<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="root">

    </div>
</body>
<script src="../react@17.js"></script>
<script src="../react-dom@17.js"></script>
<script src="../babel.js"></script>
<script type="text/babel">
    class App extends React.Component{
        constructor(){
            super();
            this.state={
                isShow:true
            }
        }
        render(){
            let {isShow} = this.state;
            return(
                <div>
                   {isShow && <Study/>}
                    <button onClick={()=>this.changeState()}>切换</button>
                </div>
            )
        }
        changeState(){
            this.setState((state)=>{
                return {
                    isShow:!state.isShow
                }
            })
        }
    }

    class Study extends React.Component{

        render(){
            return(
                <h1>
                好好学习天天游戏！！！！！！！    
                </h1>
            )
        }

    }

    ReactDOM.render(<App/>,document.getElementById("root"));
</script>
</html>